package org.accp.task.web;

import entity.task_info;
import org.accp.task.dto.PageBean;
import org.accp.task.dto.TaskDto;
import org.accp.task.service.taskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@CrossOrigin(methods= {RequestMethod.POST, RequestMethod.GET})
@RestController
public class taskInfoWeb {

    @Resource
    private taskInfoService service;

    @RequestMapping("/all")
    public PageBean alltaskInfo(TaskDto dto){
        PageBean list=this.service.alltaskInfo(dto);
        return list;
    }
    @RequestMapping("/insert")
    public Integer Tastinsert(TaskDto task){

        for (task_info s: task.getList()) {
            this.service.Tastinsert(s);
        }
        return 1;
    }
    @RequestMapping("/updata")
    public Integer UPTast(task_info i){
        this.service.UpTask(i);
        return 1;
    }
}
